package com.yunhe.rentcars.pro.service.returncar.impl;

import com.yunhe.rentcars.commons.dto.Pageable;
import com.yunhe.rentcars.pro.dao.returncar.ReturncarDao;
import com.yunhe.rentcars.pro.entity.rent.CarOrder;
import com.yunhe.rentcars.pro.service.returncar.ReturncarService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by Administrator on 2017/11/29 0029.
 */
@Service
public class ReturnCarServiceImpl implements ReturncarService {

    @Autowired
    private ReturncarDao returncarDao;
    @Override
    public Pageable<CarOrder> findList(Integer offset, Integer limit, String orderid, String mobile) {

        int count = returncarDao.count(orderid,mobile);
        List<CarOrder> carOrderList = null;
        if(count>0){
            carOrderList = returncarDao.findList(offset, limit, orderid, mobile);
        }
        Pageable<CarOrder>  pageable = new Pageable<>();
        pageable.setTotal(count);
        pageable.setRows(carOrderList);
        return pageable;
    }


}
